package com.jsy.common.wps;
 
/**
 * @Description:
 * @Auther: YY
 * @Data:2025/1/3 10:10:30
 */
public class StrUtils {
 
    public static String fileToType(String path){
        int lastIndex = path.lastIndexOf('.');
        if (lastIndex != -1) {
            // 截取文件扩展名
            String fileExtension = path.substring(lastIndex + 1);
            switch (fileExtension){
                case "doc":
                case "dot":
                case "wps":
                case "wpt":
                case "docx":
                case "dotx":
                case "docm":
                case "dotm":
                case "rtf":
                case "txt":
                case "mht":
                case "mhtml":
                case "htm":
                case "html":
                case "uot3":
                    return  "w";
                case "xls":
                case "xlt":
                case "et":
                case "xlsx":
                case "xltx":
                case "csv":
                case "xlsm":
                case "xltm":
                case "ett":
                    return  "s";
                case "ppt":
                case "pptx":
                case "pptm":
                case "ppsx":
                case "ppsm":
                case "pps":
                case "potx":
                case "potm":
                case "dpt":
                case "dps":
                case "pot":
                    return  "p";
                case "pdf":
                case "ofd":
                    return  "f";
            }
        }
        return "x";
    }
}